package com.ecoolex.discount.sales.core;

import com.ecoolex.framework.cg.mybatis.MyBatisCodeGenerator;
import com.ecoolex.framework.cg.mybatis.core.ClassPluginInterface;
import com.ecoolex.framework.cg.mybatis.pojo.KeyValue;
import com.ecoolex.framework.cg.mybatis.support.DaoClassGenerate;
import com.ecoolex.framework.cg.mybatis.support.ManagerClassGenerate;

public class DiscountSalesMyBatisCodegen {

	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		// 配置项目路径
		MyBatisCodeGenerator generator = MyBatisCodeGenerator.create("src/main/java", "com.ecoolex.discount.sales.core",
				KeyValue.create(ClassPluginInterface.TARGET_ENTITY, "com.ecoolex.discount.sales.entity"),
				KeyValue.create(ClassPluginInterface.OVERRIDE, "false"));
		// 添加转移目录
		generator.addTransferPackage("com.ecoolex.discount.sales.entity", "../discount-sales-entity/");
		// 配置数据库
		generator.setJdbcConnection("com.mysql.jdbc.Driver",
				"jdbc:mysql://47.101.161.12:3306/template-discount-sales?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull",
				"root", "Kcxx1245!", KeyValue.create("nullCatalogMeansCurrent", "true"));
		// 配置插件
		// 扩展dao插件
		generator.addPlugin(DaoClassGenerate.class);
		// 业务逻辑插件
		generator.addPlugin(ManagerClassGenerate.class);

		// 配置表
		// 自动增长主键模版
		// generator.createDefaultTable("member", "Member", "id");
		// 非自增长主键，自设主键模版
		// generator.createDefaultTable("user_info", "UserInfo");
		// 视图
		// generator.createView("user", "User");

		// 营销内容
		generator.createDefaultTable("marketing_brand", "MarketingBrand", "Id");
		generator.createDefaultTable("marketing_product", "MarketingProduct", "Id");
		generator.createDefaultTable("marketing_classify", "MarketingClassify", "Id");
		generator.createDefaultTable("marketing_classify_brand", "MarketingClassifyBrand", "Id");

		// 辅助属性
		generator.createDefaultTable("discount_classify", "DiscountClassify", "ClassifyId");
		generator.createDefaultTable("discount_brand_classify", "DiscountBrandClassify", "Id");

		// 折扣信息主表
		generator.createDefaultTable("discount_brand", "DiscountBrand", "BrandId");
		generator.createDefaultTable("discount_product", "DiscountProduct", "ProductId");
		// 券
		generator.createDefaultTable("discount_product_vouchers", "DiscountProductVouchers");
		// 礼品卡
		generator.createDefaultTable("discount_product_gift_card", "DiscountProductGiftCard");
		// 充值
		generator.createDefaultTable("discount_product_recharge", "DiscountProductRecharge");
		// 由我礼品卡
		generator.createDefaultTable("you_world_gift_card", "YouWorldGiftCard");
		generator.createDefaultTable("you_world_gift_card_order", "YouWorldGiftCardOrder");
		generator.createDefaultTable("you_world_user", "YouWorldUser", "Id");
		// 券猫
		generator.createDefaultTable("quan_mao_card", "QuanMaoCard");
		generator.createDefaultTable("quan_mao_card_order", "QuanMaoCardOrder");
		// 库存
		generator.createDefaultTable("discount_product_inventory", "DiscountProductInventory", "InventoryId");
		// 折扣附加产品
		generator.createDefaultTable("discount_product_attach", "DiscountProductAttach", "Id");

		// 订单
		generator.createDefaultTable("discount_order", "DiscountOrder", "OrderId");
		generator.createDefaultTable("discount_order_detail", "DiscountOrderDetail", "OrderDetailId");
		generator.createDefaultTable("discount_order_operation_record", "DiscountOrderOperationRecord", "RecordId");
		generator.createDefaultTable("discount_order_outinfo", "DiscountOrderOutinfo");
		generator.createDefaultTable("discount_order_refund", "DiscountOrderRefund", "RefundId");
		// 支付
		generator.createDefaultTable("payment_order", "PaymentOrder", "PaymentOrderId");
		generator.createDefaultTable("payment_order_record", "PaymentOrderRecord", "Id");
		// 卡包
		generator.createDefaultTable("card_voucher_package", "CardVoucherPackage", "CardVoucherId");

		// U计划拉取优惠券
		generator.createDefaultTable("uplan_coupon", "UPlanCoupon", "Id");
		generator.createDefaultTable("uplan_coupon_batch", "UPlanCouponBatch", "Id");

		// 由我付订单数据采集记录
		generator.createDefaultTable("you_world_order_record", "YouWorldOrderRecord", "Id");

		// 携程由我付订单接口-开始
		generator.createDefaultTable("yw_brand", "YWBrand", "Id");
		generator.createDefaultTable("yw_brand_cate", "YWBrandCate", "Id");

		generator.createDefaultTable("yw_store", "YWStore", "Id");
		generator.createDefaultTable("yw_store_cate", "YWStoreCate", "Id");

		generator.createDefaultTable("yw_gift_card", "YWGiftCard", "Id");

		generator.createDefaultTable("yw_ctrip_order", "YWCtripOrder", "Id");

		generator.createDefaultTable("yw_gift_card_order", "YWGiftCardOrder", "Id");

		generator.createDefaultTable("yw_card_info", "YWCardInfo", "Id");
		// 携程由我付订单接口-结束
		
		//由我付用户下单设备信息记录
		generator.createDefaultTable("yw_gift_order_device_record", "YwGiftOrderDeviceRecord", "Id");

		generator.generate();
	}
}
